package com.young.dynamicexcel.common.dto;

/**
 * @DESCRIPTION:
 * @USER: Young
 * @DATE: 2021/2/1 10:14
 */

public class BaseResult<T> {

    private boolean success;
    private String message;
    private T data;

    public static BaseResult success(String message){
        BaseResult result = new BaseResult();
        result.setSuccess(true);
        result.setMessage(message);
        return result;
    }

    public static BaseResult failure(String message){
        BaseResult result = new BaseResult();
        result.setSuccess(false);
        result.setMessage(message);
        return result;
    }

    public static BaseResult success(String message,Object data){
        BaseResult result = new BaseResult();
        result.setSuccess(true);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    public static BaseResult failure(String message,Object data){
        BaseResult result = new BaseResult();
        result.setSuccess(false);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
